@c Various useful Texinfo macros.

@c I'm no expert at Texinfo, so these macro definitions are probably
@c done the Wrong Way, defining a default & undefining it for every
@c output format specialization.  But it works, and it works a lot more
@c simply than other methods I considered.

@c --------------------
@c @suba{alphabetic-subscript}
@c   Format an alphabetic subscript.  In output formats that will
@c   really write a subscript, this just uses @sub; others, however,
@c   have hyphens preceding them to look nicer.

@macro suba{t}
--@sub{\t\}
@end macro

@iftex
@unmacro suba
@macro suba{t}
@sub{\t\}
@end macro
@end iftex

@ifhtml
@unmacro suba
@macro suba{t}
@sub{\t\}
@end macro
@end ifhtml

@c --------------------
@c @returns{}
@c   Display an arrow, signifying a function's codomain.  Arrows can be
@c   prettier in TeX.  (I tried the arrow entities in HTML, but they're
@c   all ugly.)

@macro returns{}
-->
@end macro

@iftex
@unmacro returns
@macro returns{}
@inlineraw{tex, $\\longrightarrow$}
@end macro
@end iftex

@c --------------------
@c @subtype{}
@c   Generate an arrow that signifies a subtype relation.  In non-TeX
@c   output, this is just a simple double-shafted arrow; in TeX, this
@c   displays as a lattice relation.

@macro subtype{}
<=
@end macro

@iftex
@unmacro subtype
@macro subtype{}
@inlineraw{tex, $\\sqsubseteq$}
@end macro
@end iftex

@c --------------------
@c @embedref{node, text}
@c   Cross-reference \node\ with hotlink text of \text\; if we're using
@c   TeX as an output format, this should use \text\ and subsequently
@c   parenthetically refer to \node\, because TeX ignores the text of
@c   the regular @ref{node, text}, making it rather hard to read.

@macro embedref{node, text}
@ref{\node\, \text\}
@end macro

@ifinfo
@unmacro embedref
@macro embedref{node, text}
\text\ (@pxref{\node\})
@end macro
@end ifinfo

@iftex
@unmacro embedref
@macro embedref{node, text}
\text\ (@pxref{\node\})
@end macro
@end iftex

@c --------------------
@c @urlref{url, text}
@c   In HTML output, the same as @uref; in other output, generates both
@c   the text and URL explicitly.  (Why @uref doesn't do this in TeX
@c   output is beyond me.)

@iftex
@macro urlref{url, text}
\text\ (@url{\url\})
@end macro
@end iftex

@ifnottex
@macro urlref{url, text}
\text\ (@url{\url\})
@end macro
@end ifnottex

@c --------------------
@c @tabledfn{fn, args, rettype}
@c   Like @defun &c., but for table entries, and with return type
@c   generation built-in.

@macro tabledfn{fn, args, rettype}
\fn\ \args\ @returns{} \rettype\
@end macro

@iftex
@unmacro tabledfn
@macro tabledfn{fn, args, rettype}
@dfn{@strong{\fn\} \args\ @returns{} \rettype\}
@end macro
@end iftex

@ifhtml
@unmacro tabledfn
@macro tabledfn{fn, args, rettype}
@strong{\fn\} @emph{\args\ @returns{} \rettype\}
@end macro
@end ifhtml

@c --------------------
@c @texonlyindent{}
@c   The same as @noindent except in TeX output, where it has no effect.
@c   This is for the beginning of sections that have parenthesized
@c   parts that shouldn't qualify as the first paragraph, i.e. shouldn't
@c   cause the next one to be indented.  (Why is the first paragraph of
@c   a section indented in TeX anyway?  It shouldn't be at all!)

@iftex
@macro texonlyindent{}
@end macro
@end iftex

@ifnottex
@macro texonlyindent{}
@noindent
@end macro
@end ifnottex

@c --------------------
@c @ie{}, @eg{}, @Eg{}, @etc{}, @etcT{}, @etal{}
@c   Commands to insert Latin abbreviations, with italicization,
@c   canonical abbreviated forms (&c. vs etc. vs et cetera), and
@c   correct sentence termination.

@macro ie{}
@i{i.e.@:}
@end macro

@macro eg{}
@i{e.g.@:}
@end macro

@macro Eg{}
@i{E.g.@:}
@end macro

@macro etc{}
@i{&c.@:}
@end macro

@c No trailing period is included here so that the surrounding text
@c will look clearer: this is intended at the end of a sentence.  (The
@c T stands  for 'terminal.')

@macro etcT{}
@i{&c}
@end macro

@macro etal{}
@i{et al.}
@end macro
